package com.titan.demo.camel.sample.eip.split.对数据循环.camel.route;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.spring.SpringRouteBuilder;

public class DemoRouteBuilder extends SpringRouteBuilder {

	@Override
	public void configure() throws Exception {
		from("direct:start")
        .split(body())
        .process(new Processor() {
			public void process(Exchange exchange) throws Exception {
				Object size = exchange.getProperty(Exchange.SPLIT_SIZE);
				Object index = exchange.getProperty(Exchange.SPLIT_INDEX);
				Object isComplete = exchange.getProperty(Exchange.SPLIT_COMPLETE);
				System.out.println("环境信息： size=["+size+"]  index=["+index+"]  isComplete=["+isComplete+"]");
				System.out.println("循环数据："+exchange.getIn().getBody());
			}
        })
        ;
	}

}
